import java.util.ArrayList;
import java.util.List;



// 抽象被观察者（博主）
interface Blogger {
    void addFans(Fans fan);
    void removeFans(Fans fan);
    void sendMessage(String message);
}

// 具体被观察者：CSDN博主
class CSDNBlogger implements Blogger {
    private List<Fans> fansList = new ArrayList<>();

    @Override
    public void addFans(Fans fan) {
        fansList.add(fan);
    }

    @Override
    public void removeFans(Fans fan) {
        fansList.remove(fan);
    }

    @Override
    public void sendMessage(String message) {
        for (Fans fan : fansList) {
            fan.receiveMessage(message); // 推送消息给所有粉丝
        }
    }
}

// 抽象观察者（粉丝）
interface Fans {
    void receiveMessage(String message);
}

// 具体观察者：用户Jack
class UserJack implements Fans {
    @Override
    public void receiveMessage(String message) {
        System.out.println("Jack收到通知：" + message);
    }
}

public class Observer {
    public static void main(String[] args) {

    }
}
